<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<pre id=p1></pre>
<pre id=p1></pre>
<pre id=p1></pre>
<script>
description("Invalidation of cached id-name collections must not crash.");

if (window.testRunner)
    testRunner.dumpAsText();

var is = window["p1"];
var div = document.createElement('div');
document.body.appendChild(div);
div.appendChild(is[is.length - 2]);
// Invalidate the underlying cache.
is.namedItem("p1").remove();
// Out of bounds index, updates the collection length.
is.item(13);
// Remove parent of collection member; must invalidate cached length.
div.remove();
// Force re-caching.
is.namedItem("p1");
</script>
</body>
</html>
